/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package actions;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author alocubiche
 */
public class DiscussionBean {
    //private List<Message> messages;
    private List<String> messages;
    private List<String> connectedUsers;

    public List<String> getConnectedUsers() {
        return connectedUsers;
    }

    public void setConnectedUsers(List<String> connectedUsers) {
        this.connectedUsers = connectedUsers;
    }
    public DiscussionBean()
    {
        //messages = new ArrayList<Message>();
        messages = new ArrayList<String>();
        connectedUsers = new ArrayList<String>();
        try{
            messages = ((ArrayList<String>) Ressources.Serialize.get());
        }
        catch(Exception ex)
        {    
            System.out.println(ex.getMessage());
        }
    }
    
    /*public List<Message> getMessages() {
        return messages;
    }

    public void setMessages(List<Message> lesMessages) {
        this.messages = lesMessages;
    }*/
    
    public List<String> getMessages() {
        return messages;
    }

    public void setMessages(List<String> lesMessages) {
        this.messages = lesMessages;
    }
    
    public void SupprimerUtilisateur(String nom)
    {
        boolean trouve = false;
        for(int i = 0; i < connectedUsers.size() || trouve == false; i++)
        {
            if (connectedUsers.get(i).equals(nom))
            {
                connectedUsers.remove(i);
                trouve = true;
            }
        }
    }

}
